/******************************************************************************************
 * Import
 ******************************************************************************************/

// module
import React, {Component} from 'react';
import {View} from 'react-native';

// project
import { TouchOpacity, ItemX, Footer, Image, Text, Hand } from '../../../library';

/******************************************************************************************
 * Export Class
 ******************************************************************************************/

export default class ActiveFooter extends Component {

	constructor(props) {
		super(props);

		/**
		 * state
		 */
		this.state = {
			
		}
	}

	/**
	 * 渲染
	 */
	render() {
        // 相关函数
		const enrollment = this.props.enrollmentBool;
        const iscollect = this.props.iscollect?true:false;
		const collectPress = this.props.collectPress?this.props.collectPress:{};
		const commitPress = this.props.commitPress?this.props.commitPress:{};
		const subPress = this.props.subPress?this.props.subPress:{};

		// 渲染
		return (
			<Footer h='60' bg='#fbfbfb' bt='1 #f2f2f2' y='center'>
				<Hand f='1' px='10' x='around' y='center'>
					<TouchOpacity active='0.7' onPress={
						()=>{collectPress}
					}>

						{iscollect?
						<ItemX x='center'  y='center'>
							<Image source={require('../../../assets/u3244.png')} w='22' h='22' mr='6'></Image>
							<Text>已收藏</Text>
						</ItemX>
						:
						<ItemX x='center'  y='center'>
							<Image source={require('../../../assets/u3244.png')} w='22' h='22' mr='6'></Image>
							<Text>收藏</Text>
						</ItemX>
						}

					</TouchOpacity>
					<Hand h='20'   w='1'  bg='#d7d7d7'></Hand>
					<TouchOpacity active='0.7' onPress={
						()=>{commitPress}
					}>
						<ItemX x='center'  y='center'>
							<Image source={require('../../../assets/u3244.png')} w='22' h='22' mr='6'></Image>
							<Text>评论</Text>
						</ItemX>
					</TouchOpacity>
				</Hand>
				{
					enrollment ? (
						// 可报名状态
						<TouchOpacity w='150' bg='#cbb383' df onPress={
							()=>{subPress}
						}>
							<Text style={{textAlign:'center'}} color='#fff' h='60' lh='60' size='18'>立即报名</Text>
						</TouchOpacity>
					) : (
						// 不可报名状态
						<TouchOpacity w='150' bg='#aeaeae' df>
							<Text style={{textAlign:'center'}} color='#fff' h='60' lh='60' size='18'>立即报名</Text>
						</TouchOpacity>
					)
				}

			</Footer>
		);
	}
}
